 Imports MySql.Data.MySqlClient 
 Imports System.Data.OleDb
Imports System.Data.SqlClient
 Imports System .Data .SqlServerCe 
 Imports System.Data.OracleClient 
Imports System.Data
Imports DTO
Public Class CAPHOCDao
Inherits AbstractDao
 #Region "New" 
 Public Sub New(ByVal connection As KetNoiDto)
 MyBase.New(connection)
 End Sub
 Public Sub New( ByVal IDCAPHOC As System.Int32, ByVal connection As KetNoiDto)
 MyBase.New("CAPHOC", "select * from CAPHOC where IDCAPHOC=" & IDCAPHOC & "", connection)
 End Sub
 #End Region 
 Public Sub Them(ByVal Dto As CAPHOCDto)
 Dim strsql As String
 strsql = "Insert into CAPHOC(TENCAPHOC,HOCPHI,TRANGTHAI,GHICHU) values (?,?,?,?)
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 Dim cmd As New OleDbCommand(strsql, Ket_noi_access)
cmd.Parameters.Add("@TENCAPHOC", OleDbType.VarWChar)
cmd.Parameters.Add("@HOCPHI", OleDbType.VarWChar)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters("@TENCAPHOC").Value = Dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = Dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New OleDbCommand(strsql, Ket_noi_access)
 Dto.IDCAPHOC = cmd.ExecuteScalar()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress
 strsql = "Insert into CAPHOC(TENCAPHOC,HOCPHI,TRANGTHAI,GHICHU) values (@TENCAPHOC,@HOCPHI,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlCommand(strsql, Ket_noi_sql)
cmd.Parameters.Add("@TENCAPHOC", SqlDbType.NVarChar)
cmd.Parameters.Add("@HOCPHI", SqlDbType.NVarChar)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters("@TENCAPHOC").Value = Dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = Dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New sqlCommand(strsql, Ket_noi_sql)
 Dto.IDCAPHOC = cmd.ExecuteScalar()
 Case Class_KieuDL.SqlCe
 strsql = "Insert into CAPHOC(TENCAPHOC,HOCPHI,TRANGTHAI,GHICHU) values (@TENCAPHOC,@HOCPHI,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlceCommand(strsql, Ket_noi_SqlCe)
cmd.Parameters("@TENCAPHOC").Value = Dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = Dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strsql = "Insert into CAPHOC(TENCAPHOC,HOCPHI,TRANGTHAI,GHICHU) values (@TENCAPHOC,@HOCPHI,@TRANGTHAI,@GHICHU)
 Dim cmd As New OracleCommand(strsql, Ket_noi_Oracle)
cmd.Parameters("@TENCAPHOC").Value = Dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = Dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Mysql
 strsql = "Insert into CAPHOC(TENCAPHOC,HOCPHI,TRANGTHAI,GHICHU) values (@TENCAPHOC,@HOCPHI,@TRANGTHAI,@GHICHU)
 Dim cmd As New MySqlCommand(strsql, Ket_noi_MySql)
cmd.Parameters.Add("@TENCAPHOC", MySqlDbType.String)
cmd.Parameters.Add("@HOCPHI", MySqlDbType.String)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters("@TENCAPHOC").Value = Dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = Dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub Xoa( ByVal IDCAPHOC As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
strSQL = "Delete From CAPHOC Where IDCAPHOC= ? 
Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@IDCAPHOC",OleDbType.Integer).Value = IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
strSQL = "Delete From CAPHOC Where IDCAPHOC= @IDCAPHOC
Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@IDCAPHOC",SqlDbType.Int).value=IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
strSQL = "Delete From CAPHOC Where IDCAPHOC=" & IDCAPHOC & "
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
strSQL = "Delete From CAPHOC Where IDCAPHOC=" & IDCAPHOC & "
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
strSQL = "Delete From CAPHOC Where IDCAPHOC=" & IDCAPHOC & "
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub sua(ByVal dto As CAPHOCDto)
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CAPHOC Set TENCAPHOC=? ,HOCPHI=? ,TRANGTHAI=? ,GHICHU= ? where IDCAPHOC= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@TENCAPHOC", OleDbType.VarWChar)
cmd.Parameters.Add("@HOCPHI", OleDbType.VarWChar)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
cmd.Parameters("@TENCAPHOC").Value = dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CAPHOC Set TENCAPHOC= @TENCAPHOC , HOCPHI= @HOCPHI , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@TENCAPHOC", SqlDbType.NVarChar)
cmd.Parameters.Add("@HOCPHI", SqlDbType.NVarChar)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
cmd.Parameters("@TENCAPHOC").Value = dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CAPHOC Set TENCAPHOC= @TENCAPHOC , HOCPHI= @HOCPHI , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
cmd.Parameters("@TENCAPHOC").Value = dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CAPHOC Set TENCAPHOC= @TENCAPHOC , HOCPHI= @HOCPHI , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
cmd.Parameters("@TENCAPHOC").Value = dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CAPHOC Set TENCAPHOC= @TENCAPHOC , HOCPHI= @HOCPHI , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
cmd.Parameters.Add("@TENCAPHOC", MySqlDbType.String)
cmd.Parameters.Add("@HOCPHI", MySqlDbType.String)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters.Add("@IDCAPHOC", MySqlDbType.Int32)
cmd.Parameters("@TENCAPHOC").Value = dto.TENCAPHOC
cmd.Parameters("@HOCPHI").Value = dto.HOCPHI
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCAPHOC").Value = dto.IDCAPHOC
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub SuaTENCAPHOC( ByVal TENCAPHOC as System.String, ByVal IDCAPHOC As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CAPHOC Set TENCAPHOC = ?  where IDCAPHOC= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TENCAPHOC", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
 cmd.Parameters("@TENCAPHOC").Value =  TENCAPHOC
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CAPHOC Set TENCAPHOC = @TENCAPHOC  where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TENCAPHOC", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
 cmd.Parameters("@TENCAPHOC").Value =  TENCAPHOC
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CAPHOC Set TENCAPHOC =" & TENCAPHOC & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CAPHOC Set TENCAPHOC =" & TENCAPHOC & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CAPHOC Set TENCAPHOC =" & TENCAPHOC & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaHOCPHI( ByVal HOCPHI as System.String, ByVal IDCAPHOC As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CAPHOC Set HOCPHI = ?  where IDCAPHOC= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@HOCPHI", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
 cmd.Parameters("@HOCPHI").Value =  HOCPHI
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CAPHOC Set HOCPHI = @HOCPHI  where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@HOCPHI", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
 cmd.Parameters("@HOCPHI").Value =  HOCPHI
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CAPHOC Set HOCPHI =" & HOCPHI & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CAPHOC Set HOCPHI =" & HOCPHI & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CAPHOC Set HOCPHI =" & HOCPHI & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDCAPHOC As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CAPHOC Set TRANGTHAI = ?  where IDCAPHOC= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
 cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CAPHOC Set TRANGTHAI = @TRANGTHAI  where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
 cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CAPHOC Set TRANGTHAI =" & TRANGTHAI & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CAPHOC Set TRANGTHAI =" & TRANGTHAI & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CAPHOC Set TRANGTHAI =" & TRANGTHAI & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaGHICHU( ByVal GHICHU as System.String, ByVal IDCAPHOC As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CAPHOC Set GHICHU = ?  where IDCAPHOC= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDCAPHOC", OleDbType.Integer)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CAPHOC Set GHICHU = @GHICHU  where IDCAPHOC= @IDCAPHOC"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDCAPHOC", SqlDbType.Int)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDCAPHOC").Value =  IDCAPHOC
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CAPHOC Set GHICHU =" & GHICHU & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CAPHOC Set GHICHU =" & GHICHU & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CAPHOC Set GHICHU =" & GHICHU & "  where IDCAPHOC=" & IDCAPHOC & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub layBang()
 Chuoi_SQL = " Select * from CAPHOC
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDCAPHOC(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDCAPHOC=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CAPHOC" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDCAPHOC(ByVal IDCAPHOC As System.Int32 )
 Chuoi_SQL = " Select * from CAPHOC where  IDCAPHOC = " & IDCAPHOC & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDCAPHOC(ByVal IDCAPHOC As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CAPHOC Where IDCAPHOC=" & IDCAPHOC & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTENCAPHOC(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TENCAPHOC='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CAPHOC" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTENCAPHOC_like (ByVal TENCAPHOC As System.String )
 Chuoi_SQL = " Select * from CAPHOC where  TENCAPHOC  like '%" & TENCAPHOC & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoTENCAPHOC(ByVal TENCAPHOC As System.String )
 Chuoi_SQL = " Select * from CAPHOC where  TENCAPHOC = '" & TENCAPHOC & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTENCAPHOC(ByVal TENCAPHOC As System.String)
 Dim strsql As String
 strSQL = "Delete From CAPHOC Where TENCAPHOC='" & TENCAPHOC & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoHOCPHI(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "HOCPHI='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CAPHOC" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoHOCPHI_like (ByVal HOCPHI As System.String )
 Chuoi_SQL = " Select * from CAPHOC where  HOCPHI  like '%" & HOCPHI & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoHOCPHI(ByVal HOCPHI As System.String )
 Chuoi_SQL = " Select * from CAPHOC where  HOCPHI = '" & HOCPHI & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoHOCPHI(ByVal HOCPHI As System.String)
 Dim strsql As String
 strSQL = "Delete From CAPHOC Where HOCPHI='" & HOCPHI & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TRANGTHAI=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CAPHOC" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32 )
 Chuoi_SQL = " Select * from CAPHOC where  TRANGTHAI = " & TRANGTHAI & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CAPHOC Where TRANGTHAI=" & TRANGTHAI & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoGHICHU(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "GHICHU='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CAPHOC" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU_like (ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from CAPHOC where  GHICHU  like '%" & GHICHU & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU(ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from CAPHOC where  GHICHU = '" & GHICHU & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoGHICHU(ByVal GHICHU As System.String)
 Dim strsql As String
 strSQL = "Delete From CAPHOC Where GHICHU='" & GHICHU & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangNhieuTable
 Chuoi_SQL = " Select IDCAPHOC ,TENCAPHOC ,HOCPHI ,TRANGTHAI ,GHICHU  from CAPHOC"
 Doc_bang()
 End sub
Public Sub TaoTable()
Dim strsql As String
strsql = ""
Select Case ketnoi.MsSql
Case Class_KieuDL.Access 
Case Class_KieuDL.Sql, Class_KieuDL.sqlExpress
strsql = ""
Case Class_KieuDL.SqlCe
strsql = ""
Case Class_KieuDL.Oracle
strsql = ""
Case else 
strsql = ""
End Select
Thuc_hien_lenh(strsql)
End Sub
 End Class

